<!-- 入驻列表 -->
<style>
    th {
        text-align: center;
    }
    
    .table>tbody>tr>td {
        line-height: 60px;
        text-align: center;
        height: 50px;
        margin: 0px;
    }
</style>

<div id="data_page" class="in_page">
        <div class="panel panel-default">
            <div class="panel-body">
                <form class="form-inline" method="get" name="keyword" id="keyword">
                    <div class="form-group" style="float:left;margin-left:2%">
                        <input type="text" class="form-control" id="exampleInputName2" name="keyword" value="{:I('keyword')}" placeholder="商品">
                    </div>
    
                    <button type="submit" class="btn btn-sm btn-primary" style="margin-left:2%">搜索</button>
                    <div class="btn-group" role="group" aria-label="..." style="float:right;margin-right:20px">
                          <a href="{:U('goods_add')}"><button type="button" class="btn btn-primary">添加</button></a>
                    </div>
                </form>
            </div>
        </div>
        
    <table class="table table-striped table-bordered table-condensed ">
        <thead>
            <tr>
                <th>图片</th>
                <th>商品名称</th>
                <th>价格</th>
                <th>经销商</th>
                <th>排序(升序)</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <volist name="list" id="li">
                <tr>
                    <td><img src="{$li.picture}"  width="50px" height="50px"/></td>
                    <td>{$li.goods_name}</td>
                    <th>{$li.price}</th>
                    <td>{$li.shop_name}</td>
                    <td>{$li.sort}</td>
                    <td>{$li.is_on_sale}</td>
                    <td>
                        <a href="{:U('goods_edit',array('id'=>$li['id']))}">
                            <button type="button" class="btn btn-sm btn-success" >修改</button>
                        </a>
                        <button type="button" class="btn btn-sm btn-danger del" d_id="{$li.id}">删除</button>
                    </td>
                </tr>
            </volist>
        </tbody>
    </table>
</div>
<div>{$page}</div>

<style>
    #img{
      width:700px;
      height:550px;
      position: absolute;
      top:5%;
      left:20%;
      background-color: #FFFFFF;
      border-radius: 10px;
      box-shadow:10px 10px 10px 5px #888888;
    }
    
    #order{
        width:100px;
        height:20px;
        display: block;
    }
    
    #Stick{
      width:500px;
      height:300px;
      position: absolute;
      top:5%;
      left:20%;
      background-color: #FFFFFF;
      border-radius: 10px;
      box-shadow:10px 10px 10px 5px #888888;    
    }
    
    #tuichu{
        position: absolute;
        right:0px;
        bottom:0px;
    }
</style>
<script>
    $(function(){
        //删除店铺
        $(".del").click(function(obj){
            $_this = $(this);
            var id = $(this).attr("d_id");
            if(confirm("您确认删除吗?")){
                $.post("{:U('goods_del')}", {'id':id},function(obj){
                    alert(obj.m);
                    if(obj.s){
                        $_this.parent().parent().remove();
                        // if(typeof(obj.url) != undefined && obj.url){
                        //     location.href = obj.url;
                        // }
                    }
                })
            }
            return false;
        }) 
        $(".ajax-post").click(function(t){
            var $this = $(t);
            var url = $this.attr('href');
            if($this.hasClass('confirm')){
                if(confirm($this.data('original-title'))){

                }
            }else{
                $.post(url, {},function(obj){
                    if(obj.status){
                        if(typeof(obj.url) != 'undefined' && obj.url){
                            location.href = obj.url;
                        }
                    }else{
                        alert(obj.info);
                    }
                })
            }
            return false;
        })                                  
    })
</script>
